﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ConfigReader;
using ConfigServices;
using LogServices;

namespace MailServices
{
  public class MailService : IMailServiece
  {
    private readonly ILogProvider log;
    //private readonly IConfigService config;
    private readonly IConfigReader config;

    public MailService(ILogProvider log, /*IConfigService config,*/ IConfigReader reader)
    {
      this.log = log;
     // this.config = config;
      this.config = reader;
    }

    public void Send(string title, string to, string body)
    {
      log.LogInfo("准备发送邮件");
      string smtpServer = config.GetValue("SmtpServer");
      string userName = config.GetValue("UserName");
      string password = config.GetValue("Password");
      Console.WriteLine($"邮件服务器地址：{smtpServer},{userName},{password}");
      Console.WriteLine($"发送给{to}的标题为{title}的邮件：{body}");
      Console.WriteLine("邮件发送完成");


    }
  }
}
